﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using ICSharpCode.TextEditor.Document;

namespace QuickNotepad
{
    public partial class DocumentForm : DockContent
    {
        public DocumentForm(MainForm mainform)
        {
            InitializeComponent();
            _MainForm = mainform;
            this.rtxtEditor.EnableFolding = true;
            this.rtxtEditor.Encoding = Encoding.UTF8;
            this.rtxtEditor.IsIconBarVisible = true;
            
        }

        MainForm _MainForm;
        private string _ActiveLanguage;

        public string ActiveLanguage
        {
            get { return _ActiveLanguage; }
            set
            {
                if (value == string.Empty)
                    _ActiveLanguage = "TXT";
                else
                    _ActiveLanguage = value;
                try
                {
                    SyntaxModeProviders smp = new SyntaxModeProviders();
                    HighlightingManager.Manager.AddSyntaxModeFileProvider(smp);
                    this.rtxtEditor.SetHighlighting(_ActiveLanguage);
                }
                catch 
                {
                    
                    
                }
                
            }
        }

        
    }
}
